package com.passive.lock;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 开发环境下的启动服务器类
 * 
 * @author xwb
 * @since 2016年1月13日
 */
@SpringBootApplication
// @EnableAutoConfiguration
@EnableTransactionManagement
@ServletComponentScan
@ComponentScan(basePackages = { "com.passive.lock" })
@MapperScan("com.passive.lock.mapper")
@EnableAsync

//@EnableWebMvc
public class App extends WebMvcConfigurerAdapter {
	public static void main(String[] args) {
		SpringApplication.run(App.class, args);
	}
	
	
	/**
	 * 配置拦截器
	 *//*
	  @Bean
	  public UserSecurityInterceptor logInterceptor() {
	    return new UserSecurityInterceptor();
	  }
	  @Override
	    public void addInterceptors(InterceptorRegistry registry) {
	        super.addInterceptors(registry);
	        InterceptorRegistration ir = registry.addInterceptor(logInterceptor());
		  if("production".equals(active) || checkLogin){
			 
			  ir.addPathPatterns("/declare/**");
			  ir.addPathPatterns("/ucenter/**");
			  ir.addPathPatterns("/declaration/**");
			  ir.addPathPatterns("/export/**");
			  ir.addPathPatterns("/generate/**");
			  ir.addPathPatterns("/pay/**");
			  ir.addPathPatterns("/transfor/**");
		  }
		  ir.addPathPatterns("/order/**");
	    }
	  @Bean
	  public EmbeddedServletContainerCustomizer containerCustomizer() {

	      return new EmbeddedServletContainerCustomizer() {
	          @Override
	          public void customize(ConfigurableEmbeddedServletContainer container) {
	              ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/error/401");
	              ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/error/404");
	              ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500");
	              container.addErrorPages(error401Page, error404Page, error500Page);
	          }
	      };
	  }
*/
	
}
